#!/usr/bin/env python

from google.appengine.ext import db
from google.appengine.ext.db import polymodel

from models.root_models import rcPlayer, rcItem
from models.tier_models import rcTier

class rcRaidData(db.Model):
  raidID = db.IntegerProperty(required=True)
  raidZone = db.StringProperty(required=True) # Will eventually refer to a Zone reference when I implement Zones/Tiers
  raidName = db.StringProperty(required=True)
  raidDate = db.DateTimeProperty(required=True)
  raidValid = db.BooleanProperty(default=False)

class rcRaidDrop(polymodel.PolyModel):
  item = db.ReferenceProperty(rcItem, collection_name="drop_instances", required=True) # Refers to an rcItem instance
  raid = db.ReferenceProperty(rcRaidData, collection_name="loots", required=True) # Refers to an rcRaidData instance
  tier = db.ReferenceProperty(rcTier, collection_name="tier_drops", required=True)
  slot = db.StringProperty(required=True, choices=set(["Legendary Thing", 'Trade Good', "Quest Item", "Head", "Neck", "Shoulders", "Back", "Chest", "Wrist", "Hand", "Waist", "Legs", "Feet", "Finger", "Trinket", "One Hand", "One Hand (Hunter)", "Two Hand", "Two Hand (Hunter)", "OH / Shield", "Ranged", "Ranged (Hunter)"]))
  banked = db.BooleanProperty(required=True)
  disenchanted = db.BooleanProperty(required=True)

class rcLootedDrop(rcRaidDrop):
  looter = db.ReferenceProperty(rcPlayer, collection_name="looted_items", required=True) # Refers to an rcPlayer instance
  dkpCost = db.FloatProperty(default=0)
  onspec = db.BooleanProperty(required=True) # On-spec = True, Off-spec = False.

class rcRaidPenalty(db.Model):
  raid = db.ReferenceProperty(rcRaidData, collection_name="penalties", required=True) # Refers to an rcRaidData instance
  player = db.ReferenceProperty(rcPlayer, collection_name="penalties", required=True) # Refers to an rcPlayer instance
  description = db.StringProperty(required=True)
  dkpCost = db.FloatProperty(default=0)

class rcRaidAttendee(db.Model):
  player = db.ReferenceProperty(rcPlayer, collection_name="raids_attended", required=True) # Refers to an rcPlayer instance
  raid = db.ReferenceProperty(rcRaidData, collection_name="attendees", required=True) # Refers to an rcRaidData instance
  dkpGain = db.FloatProperty(default=0)